<template>
	<view class="content">
		<view class="topbg">
			<view class="txt1">社区奖励</view>
			<view class="card-1">
				<view class="flex border">
					<view class="txt6">直推人数</view>
					<u-icon name="arrow-right" color="#BBBBBB" size="28"></u-icon>
				</view>
				<view class="infos">
					<view class="flex-com">
						<view class="txt2">{{referee.active||0}}</view>
						<view class="txt3">已激活</view>
					</view>
					<view class="flex-com">
						<view class="txt2">{{referee.not_active||0}}</view>
						<view class="txt3">未激活</view>
					</view>
				</view>
				<view class="infos">
					<view class="flex-com" @click="ToPage('/pages/Mine/asset/asset',referee.bill_id)">
						<view class="txt2">{{referee.profit||0.00}}</view>
						<view class="txt3">直推总盈利</view>
					</view>
					<view class="flex-com" @click="ToPage('/pages/Mine/asset/asset',referee.bill_id)">
						<view class="txt2">{{referee.today_profit||0.00}}</view>
						<view class="txt3">直推今日盈利</view>
					</view>
				</view>
			</view>
			<view class="card-1">
				<view class="flex border">
					<view class="txt6">团队奖励</view>
						<view class="">
						<text class="txt4" v-show="userInfo.member_group_id<=0"  @click="gotopage('/pages/Mine/invitation/invitation?par_value='+par_value)">激活</text>
						<u-icon v-show="userInfo.member_group_id<=0" name="arrow-right" color="#BBBBBB" size="28"></u-icon>
					</view>	
				</view>
				<view class="infos" @click="ToPage('/pages/Mine/asset/asset',team.bill_id)">
					<view class="flex-com">
						<view class="txt2">{{team.today_profit||0.00}}</view>
						<view class="txt3">今日收益</view>
					</view>
					<view class="flex-com">
						<view class="txt2">{{team.yestoday_profit||0.00}}</view>
						<view class="txt3">昨日收益</view>
					</view>
					<view class="flex-com">
						<view class="txt2">{{team.total_profit||0.00}}</view>
						<view class="txt3">累计收益</view>
					</view>
				</view>
			</view>
			<view class="card-1">
				<view class="flex border">
					<view class="txt6">节点奖励</view>
					<view class="">
						<text class="txt4">立即升级</text>
						<u-icon name="arrow-right" color="#BBBBBB" size="28"></u-icon>
					</view>					
				</view>
				<view class="infos" @click="ToPage('/pages/Mine/asset/asset',node.bill_id)">
					<view class="flex-com">
						<view class="txt2">{{node.today_profit||0.00}}</view>
						<view class="txt3">今日收益</view>
					</view>
					<view class="flex-com">
						<view class="txt2">{{node.yestoday_profit||0.00}}</view>
						<view class="txt3">昨日收益</view>
					</view>
					<view class="flex-com">
						<view class="txt2">{{node.total_profit||0.00}}</view>
						<view class="txt3">累计收益</view>
					</view>
				</view>
			</view>
		</view>
		<u-modal v-model="show" @confirm="GoPwd" content="您还未设置交易码,设置后才能继续" confirm-text="去设置" show-cancel-button></u-modal>
	</view>
</template>

<script>
export default {
	data() {
		return {
			show:false,
			referee:{},
			team:{},
			node:{},
			userInfo:{},
			par_value:0
		};
	},
	onLoad(e) {
		if(e.par_value){
			this.par_value = e.par_value
		}
	},
	onShow() {
		try {
		    const userInfo = uni.getStorageSync('userInfo');
		    if (userInfo) {
		        console.log('当前数据------',userInfo);
				if(userInfo){
					this.userInfo = userInfo
				}
		    }
		} catch (e) {
		    // error
		}
		this.getList()
	},
	onPullDownRefresh() {
		this.getList()
	},
	methods: {
		// 点击激活
		gotopage(e) {
			if(!this.userInfo.safety_code){
				this.show = true
			}else{
				uni.navigateTo({
					url: e
				});
			}
			
		},
		//去设置交易码
		GoPwd(){
			uni.navigateTo({
			    url: '/pages/PassWord/password?type=1'
			});
		},
		//获取信息
		getList(){
			this.$http({
				url:this.$api.groupIncome,
				method:'GET',
				hideLoading:true,
				data:{},
				success:res=>{
					console.log('社区接口返回----------',res)
					this.referee = res.data.referee //直推
					this.team = res.data.team //团队
					this.node = res.data.node//节点
				},complete:e=>{
					console.log('返回-----------',e)
					uni.hideLoading();
				}
			})
		},
		// 页面跳转
		ToPage(url,type){
			uni.navigateTo({
			    url: `${url}?type=${type}`
			});
		},
		goback() {
			uni.switchTab({
				url: '../index'
			});
		}
	}
};
</script>

<style>
page {
	background: #f8f8f8;
}
.content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: #f8f8f8;
}

.topbg {
	background: #2f73fd;
	height: 446rpx;
	width: 100%;
}
.txt1 {
	font-size: 60rpx;
	font-weight: 600;
	color: #ffffff;
	line-height: 106rpx;
	margin: 80rpx 36rpx 80rpx;
}
.card-1 {
	width: 696rpx;
	padding: 24rpx;
	border-radius: 20rpx;
	margin: 10px auto;
	background: #fff;
	display: flex;
	flex-direction: column;
}

.txt2 {
	font-size: 30rpx;
	font-weight: 600;
	color: #000000;
	line-height: 28rpx;
	text-align: center;
	margin-top: 10px;
}



.flex {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-direction: row;
	width: 100%;
}
.txt3 {
	font-size: 24rpx;
	font-weight: 400;
	color: #8b8b93;
	line-height: 34rpx;
	margin-top: 12rpx;
}
.txt4 {
	font-size: 24rpx;
	font-weight: 400;
	color: #8B8B93;
	line-height: 34rpx;
}
.txt5 {
	font-size: 22rpx;
	font-weight: 600;
	color: #000000;
	line-height: 32rpx;
	width: 82rpx;
	overflow: hidden;
}
.bbsd {
	height: 36rpx;
	background: #f7f6fa;
	border-radius: 18rpx;
	padding: 0 10rpx;
	display: flex;
}
.btn-bottom {
	width: 626rpx;
	height: 70rpx;
	background: #2f73fd;
	box-shadow: 0px 4px 8px 0px rgba(166, 196, 255, 1);
	border-radius: 40rpx;
	text-align: center;
	line-height: 80rpx;
	color: #fff;
	font-size: 32rpx;
	margin-top: 27rpx;
}
.card-3 {
	width: 696rpx;
	height: 100%;
	background: #ffffff;
	border-radius: 20rpx;
	margin: 20rpx auto;
}
.txt6 {
	font-size: 32rpx;
	font-weight: 600;
	color: #333333;
	line-height: 44px;
}
.border {
	border-bottom: 1px solid #f8f8f8;
}
.infos {
	font-size: 22rpx;
	color: #333;
	padding: 14rpx;
	line-height: 32rpx;
	display: flex;
	justify-content: space-between;
}
.flex-com {
	display: flex;
	justify-content: center;
	flex-direction: column;
	flex: 1;
	align-items: flex-start;
}
</style>
